/**
 * 
 */
package infocluster.util;

import java.util.Hashtable;

/**
 * @author 08302010017 Xi Qi
 *
 */
public class Utility {
	
	private static final Hashtable<String,String> DISTRICT = new Hashtable<String,String>();
	private static final Hashtable<String,String> CATEGORY = new Hashtable<String,String>();
	private static final Hashtable<String,String> CITY = new Hashtable<String,String>();
	
	static{
		DISTRICT.put("卢湾", "Luwan");
		DISTRICT.put("徐汇", "Xuhui");
		DISTRICT.put("长宁", "Changning");
		DISTRICT.put("普陀", "Putuo");
		DISTRICT.put("闸北", "Zhabei");
		DISTRICT.put("虹口", "Hongkou");
		DISTRICT.put("杨浦", "Yangpu");
		DISTRICT.put("浦东新", "Pudong");
		DISTRICT.put("宝山", "Baoshan");
		DISTRICT.put("黄浦", "Huangpu");
		DISTRICT.put("嘉定", "Jiading");
		DISTRICT.put("闵行", "Minhang");
		DISTRICT.put("静安", "Jingan");
		DISTRICT.put("金山", "Jinshan");
		DISTRICT.put("奉贤", "Fengxian");
		DISTRICT.put("青浦", "Qingpu");
		DISTRICT.put("松江", "Songjiang");
		
		CITY.put("上海", "Shanghai");

		CATEGORY.put("美食", "Dining");
		CATEGORY.put("美食天下", "Dining");
		CATEGORY.put("美容美发", "Health and Beauty");
		CATEGORY.put("休闲娱乐", "Nightlife");
		CATEGORY.put("休闲购物", "Shopping");
	}
	
	public static String getDistrict(String addr){
		int index;
		
		if((index = addr.indexOf("区")) != -1){
			return DISTRICT.get(addr.substring(0, index));
		}
		
		return addr;
	}

	public static String getCategory(String category){
		return CATEGORY.get(category);
	}
	
	public static String getCity(String city){
		return CITY.get(city);
	}
	
}
